<?php

declare (strict_types=1);
/**
 * @copyright 深圳市易果网络科技有限公司
 * @version 1.0.0
 * @link https://dayiguo.com
 */

namespace App\Dao;

use App\Kernel\Traits\DaoTrait;
use App\Model\CouponPayment;

/**
 * class
 *
 * @author 张昊(2396675557@qq.com)
 * @package App\Dao
 */
class CouponPaymentDao extends Dao
{
    use DaoTrait;

    public function model(): string
    {
        return CouponPayment::class;
    }

    /**
     * 查询单条数据
     * @param array $where
     * @return  mixed
     */
    public function fired(array $where)
    {
        return CouponPayment::query()->where($where)->first();
    }

    /**
     * 查出该记录，不存在则创建
     *
     * @param array $condition
     * @param array $data
     * @return mixed
     */
    public function firstOrCreate(array $condition, array $data)
    {
        return self::makeModel()->firstOrCreate($condition, $data);
    }
}